# -*- coding: utf-8 -*-
# @Time    : 2021/5/6 14:54
# @Author  : 夏思毅
# @Email   : 2739124228@qq.com
# @File    : 面向对象atm.py
# @Software: PyCharm


#1、分析atm存取款功能
#两个类： ATM  用户
#ATM：
#属性：  钱，名称，位置
#方法：  放钱进去， 取出atm里面的钱

#用户：
#属性： 账户名，密码，账户金额
#方法： 存钱，取钱，查看金额
# users={'1':'1','root':'1234','xsy':'123456'}
# class Atm():
#     def __init__(self,atm_money,name,location):
#         self.atm_money = atm_money
#         self.name = name
#         self.location = location
#     def save(self,save_money):
#         self.atm_money+=save_money
#         return f"atm机余额{self.atm_money}"
#     def draw(self,draw_money):
#         self.atm_money-=draw_money
#         return f"atm机余额{self.atm_money}"
#
#
# class User():
#     def __init__(self,user_money,name,passwd):
#         self.user_moeny=user_money
#         self.user_name=name
#         self.user_passwd=passwd
#     def save(self,save_money,atmobj):
#         self.user_moeny+=save_money
#         atmobj.atm_money+=save_money
#         return (f"存钱{save_money}元,个人余额为{self.user_moeny}")
#     def draw(self,draw_money,atmobj):
#         if draw_money<=self.user_moeny and draw_money<=atmobj.atm_money:
#             atmobj.atm_money-=draw_money
#             self.user_moeny-=draw_money
#             return (f"取钱{draw_money}元,个人余额为{self.user_moeny}")
#         else:
#             return "取钱取得太多"
#     def check(self):
#         return (f"个人余额为{self.user_moeny}")
#
#     def login(self):
#         while 1:
#             username = input("请输入用户名：")
#             if username in users.keys():
#                 userpawd = input("请输入密码:")
#                 if userpawd in users.values():
#                     print("欢迎登录，请选取数字进行接下来的操作".center(65, '*'))
#                     break
#                 else:
#                     print('登陆失败,重新输入密码!')
#             else:
#                 print('没有该用户，请重新输入。')
# a=Atm(5000,"奇怪的ATM","HuNan")
# b=User(200,'xsy',123456)
# while 1:
#     b.login()
#     while 1:
#         print("取钱：1".center(20,'='))
#         print("存钱：2".center(20,'='))
#         print("查询：3".center(20,'='))
#         print("退出：4".center(20,'='))
#         choice = input("请输入：")
#         if choice == '1':
#             money1=int(input("quqian:"))
#             print(a.draw(money1))
#             print(b.draw(money1,a))
#         elif choice == '2':
#             money2=int(input("cunqian:"))
#             print(a.save(money2))
#             print(b.save(money2,a))
#         elif choice =='3':
#             print(b.check())
#             print(f"atm机余额{a.atm_money}")
#         elif choice == '4':
#             exit()







# 斐波拉契数列
# class fblq():
#     num=0
#     num2=1
#     def __iter__(self):
#         return self
#     def __next__(self):
#         #self.geshu = geshu
#         # for i in range(geshu):
#             fblq.num, fblq.num2 = fblq.num2, fblq.num + fblq.num2
#             return fblq.num
#
# a=fblq()
# print(a.__next__())
# print(a.__next__())
# print(a.__next__())
# print(a.__next__())
#
#
# result = [next(a) for i in range(10)]
# print(result)
